package com.friends.gobrs.task;

import com.gobrs.async.core.TaskSupport;
import com.gobrs.async.core.anno.Task;
import com.gobrs.async.core.task.AsyncTask;
import lombok.extern.slf4j.Slf4j;

/**
 *
 * @Author Zhao Tianhao
 * @Description
 * @Date 2024/9/10 14:30
 */
@Slf4j
@Task(callback = true)
public class GobrsTaskB extends AsyncTask<Object, Object> {
	@Override
	public Object task(Object o, TaskSupport taskSupport) {
		log.info("B----这是实际的任务处理");
		return null;
	}

	@Override
	public void prepare(Object o) {
		log.info("B----任务处理前回调");
	}

	@Override
	public boolean necessary(Object o, TaskSupport support) {
		log.info("B任务，执行。判断任务是否执行，返回true执行，返回false不执行");
		return true;
	}

	@Override
	public void onSuccess(TaskSupport support) {
		log.info("B----执行成功之后的回调");
	}

	@Override
	public void onFail(TaskSupport support, Exception exception) {
		log.info("B----执行失败之后的回调");
	}

	@Override
	public void rollback(Object o) {
		log.info("B----回滚，具体实现需要自己实现");
	}
}
